#Cairo canvas. The following variables are available:
# * CNTX: A reference to the current cairo context object
# * W: Canvas width
# * H: Canvas height
# Have fun!
from math import pi
from random import randint

def draw( a_list, color ):
    CNTX.set_source_rgb(*color)
    for p in a_list:
        # sphere
        CNTX.arc( p[0], p[1], 7, 0, 2*pi)
        CNTX.fill()

point1 = (200,100)
point2 = (300,400)

max_point = ( max(point1), max(point2) )
min_point = ( min(point1), min(point2) )
sum_point = ( sum(point1), sum(point2) )

fijos = ( point1, point2 )
draw( fijos, COLOR("Red") )

draw( ( max_point, min_point, sum_point ), COLOR("Yellow") )

secuencia = range( 0, W, 20 )
azules = []
for i in secuencia:
    azules.append( (i,i) )
    
draw( azules, COLOR("Blue") )

verdes = [ (i,i + 20) for i in range(0, W, 20) ]
draw( verdes, COLOR("LimeGreen") )

combinados = [ ( p[0], p[1] + 20 ) for p in verdes ] 
draw( combinados[:len(combinados)/4], COLOR("Black") )
draw( combinados[len(combinados)/4:len(combinados)/2], COLOR("White") )
draw( combinados[len(combinados)/2:], COLOR("Black") )

aleatorio = [ ( randint(0, W), randint(0, H) ) for i in range (0, 10)  ]
draw( aleatorio, COLOR("MediumOrchid1") )

# uso de slices operations


